import type { PageVo, Pagination } from "./pagination";
export class CommentVo {
  id: string;
  //评论类型（0代表文章评论，1代表友链评论）
  type: string;
  //文章id
  articleId: string;
  //根评论id
  rootId: string;
  //评论内容
  content: string;
  //所回复的目标评论的userid
  toCommentUserId?: string;
  toCommentUserName?: string;
  //回复目标评论id
  toCommentId?: string;

  createBy?: string;

  createTime?: string;
  username: string;
  updateBy?: string;
  avatar: string;
  updateTime?: string;
  constructor() {
    this.id = "";
    //评论类型（0代表文章评论，1代表友链评论）
    this.type = "";
    //文章id
    this.articleId = "";
    //根评论id
    this.rootId = "";
    //评论内容
    this.content = "";
    //所回复的目标评论的userid
    this.toCommentUserId = "";
    //回复目标评论id
    this.toCommentId = "";
    this.createBy = "";
    this.createTime = "";
    this.updateBy = "";
    this.avatar = "";
    this.updateTime = "";
    this.username = "";
  }
}
export class CommentTree extends CommentVo {
  children?: Array<CommentTree>;
  constructor() {
    super();
    this.children = [];
  }
}
export type CommentListVo = Array<CommentTree>;
export type CommentPage = PageVo<CommentTree>;
// 分页查询文章
export type QueryComment = Omit<Pagination, "total"> & {
  articleId: string;
};
export type CommentDto = Pick<
  CommentVo,
  "type" | "toCommentId" | "toCommentUserId" | "articleId" | "rootId"
>;
